import * as React from 'react';
import { graphql } from 'gatsby';
import { Article } from '../components';

const ArticleTemplate = ({ data }) => {
  const { markdownRemark } = data;
  return <Article markdownRemark={markdownRemark} />;
};

export default React.memo(ArticleTemplate);

export const pageQuery = graphql`
  query($path: String!) {
    markdownRemark(frontmatter: { path: { eq: $path } }) {
      htmlAst
      frontmatter {
        date(formatString: "YYYY年MM月DD日")
        path
        title
        thumbnail
        metaDescription
      }
    }
  }
`;
